<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>无标题文档</title>


<style scoped>
	/* input{border: 1px solid #ccc: padding: 5px 0px; border-radius: 3px; padding-left:5px; }
	*{color: #848482:}*/
 

</style>


<script src="/js/vue.min.js"></script>

<link href="/css/base.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="/js/axios.min.js"></script>

<script src="/ckeditor/ckeditor.js"></script>
           
</head>

<body >
  <div id="jieshaoDiv">
	       <table width="98%" align="center" border="0" cellpadding="4" cellspacing="1" bgcolor="#F5F5F5" style="margin-bottom:8px">
						<tr bgcolor="#FFFFFF" style="height: 38px;">
						    <td width="103" bgcolor="#FFFFFF" align="right">
						        信息内容：
						    </td>
						    <td bgcolor="#FFFFFF" align="left">
						        <textarea class="ckeditor" name="neirong">{{jieshao.neirong}}</textarea>
						    </td>
						</tr>
						<!-- <tr bgcolor="#FFFFFF" style="height: 38px;">
						    <td width="103" bgcolor="#FFFFFF" align="right">
						          附件上传：
						    </td>
						    <td bgcolor="#FFFFFF" align="left">
								<input type="text" size="60" readonly="readonly" v-model="jieshao.fujian"/><br/>
						        <input type="file" ref="fileRef" accept="*" @change="handleFileChange($event)"/>
								<input type="button" value="上传" style="width: 66px;" @click="upload()"/>
								<input type="hidden" size="60" readonly="readonly" v-model="jieshao.fujianYuan"/>
						    </td>
						</tr>
						<tr bgcolor="#FFFFFF" style="height: 38px;">
						    <td width="103" bgcolor="#FFFFFF" align="right">
						         备注：
						    </td>
						    <td bgcolor="#FFFFFF" align="left">
								<input type="text" size="60" v-model="jieshao.beizhu"/>
						    </td>
						</tr> -->
						<tr bgcolor="#FFFFFF" style="height: 38px;">
						    <td width="103" bgcolor="#FFFFFF" align="right">
						        &nbsp;
						    </td>
						    <td bgcolor="#FFFFFF" align="left">
						       <input type="button" value="提交" @click="jieshaoUpdate()" class="lanse" style="width: 86px;"/>&nbsp; 
						    </td>
						</tr>
					 </table>
  </div>
  


<script type="text/javascript">
	var vm = new Vue({
		
		el: '#jieshaoDiv',
		data: 
		{
			jieshao:{
								
			},

			file:"",
		},
		methods: 
		{
			
			getData()
			{
               axios({
						method: 'POST',
						url: '/jieshaoMana',
						params:{
							id:1,
						}
						}).then(data => {
							if (data.data.state == 66)
							{
								this.jieshao=data.data.data;
							} 
						    
						}).catch(error => {
							alert(error);
			    })
			},
			
			
			jieshaoUpdate()
			{
				var txt = CKEDITOR.instances.neirong.getData(); 
				this.jieshao.neirong=txt;

				this.update();
			},

			update()
			{
				axios({
						method: 'POST',
						url: '/jieshaoUpdate',
						data: this.jieshao,
						/* params:{
							username:this.jieshao.userName,
							password:this.jieshao.userPw,
						} */
						}).then(data => {
							if (data.data.state == 66)
							{
								alert("修改成功");
							} 
						    
							
						}).catch(error => {
							alert(error);
						})
			},

			
			
			handleFileChange(event) 
			{
				this.file = event.target.files[0];
			},

			upload()
			{
				/* if(this.$refs.fileRef.value=="") */
				if(this.file=="")
				{
					alert("请选择文件");
					return false;
				}

				let formFile = new FormData();
				formFile.append("file", this.file);
				
                axios({
						method: 'POST',
						url: '/upload',
						data: formFile, 
						/* params:{
							username:this.jieshao.userName,
							password:this.jieshao.userPw,
						} */
						}).then(data => {
							if (data.data.state == 66)
							{
								alert("上传成功");
								this.file='';
								var fujian=data.data.data; 
								this.jieshao.fujian=fujian.fujian;
								this.jieshao.fujianYuan=fujian.fujianYuan;
							} 
						}).catch(error => {
							alert(error);
				})


			},

						
		},

		created()
		{
			this.getData();
		},
		mounted()
		{
		    CKEDITOR.replace("neirong", {height: "400px", width: "100%", toolbar: "Full"});
		},
	
	    
	})
</script>





</body>
</html>
